<template>
	<view class="uni-container">
		<view class="my_container_header">
			<view class="my_header1" @click="gologin()">
				<open-data type="userAvatarUrl" class="my_img"></open-data>
				<open-data type="userNickName" class='my_title'></open-data>
			</view>
			<view class="my_header2">
				<img src="@/static/icon(3).png" alt="" class="icon">
				<img src="@/static/xxx(6).png" alt="" class="icon">
				<img src="@/static/icon(2).png" alt="" class="icon1">
			</view>
		</view>
		<uni-grid :column="4" :showBorder="false" :square="false" class="my_tabs">
			<uni-grid-item class="my_items">
				<view class="pic" @click="goOrders()">0</view>
				<text class="text1">剩额</text>
			</uni-grid-item>
			<uni-grid-item class="my_items">
				<view class="pic" @click="goOrders()">100</view>
				<text class="text1">积分</text>
			</uni-grid-item>
			<uni-grid-item class="my_items">
				<view class="pic" @click="goOrders()">0</view>
				<text class="text1">优惠卷</text>
			</uni-grid-item>
			<uni-grid-item class="my_items">
				<view class="pic" @click="golike()">{{likelistlength}}</view>
				<text class="text1">收藏</text>
			</uni-grid-item>
		</uni-grid>
		<view class="my_back">
			<p class="my_dingdan">
				<text class="my_dingdan1">我的订单</text>
				<text class="my_dingdan2" @click="goOrders(0)">全部订单》</text>
			</p>
			<uni-grid :column="5" :showBorder="false" :square="false" class="my_tabs">
				<uni-grid-item class="my_items">
					<view class="pic" @click="goOrders(1)"><img src="@/static/toPay.png" class="my_topay"></view>
					<text class="text1">待支付</text>
				</uni-grid-item>
				<uni-grid-item class="my_items">
					<view class="pic" @click="goOrders(2)"><img src="@/static/toDelivery.png" class="my_topay"></view>
					<text class="text1">待发货</text>
				</uni-grid-item>
				<uni-grid-item class="my_items">
					<view class="pic" @click="goOrders(3)"> <img src="@/static/toTake.png" class="my_topay"></view>
					<text class="text1">待收货</text>
				</uni-grid-item>
				<uni-grid-item class="my_items">
					<view class="pic" @click="goOrders(4)"><img src="@/static/toComment.png" class="my_topay"></view>
					<text class="text1">已完成</text>
				</uni-grid-item>
				<uni-grid-item class="my_items">
					<view class="pic"><img src="@/static/shouh.png" class="my_topay2"></view>
					<text class="text1">退款/售后</text>
				</uni-grid-item>
			</uni-grid>
		</view>
		<view class="my_zhongx">
			<p class="zx">
			<p class="my_xxx">
				<span class="my_fenx">
					分销中心
				</span>
				<span class="my_yongj">
					分享转化获佣金
				</span>
			</p>
			<span class="my_right">
				<img src="@/static/icon(4).png" alt="" class="redbao">
			</span>

			</p>

			<p class="zx">
			<p class="my_xxx" @click="goGame()">
				<span class="my_fenx">
					积分商城
				</span>
				<span class="my_yongj">
					攒积分兑好礼
				</span>
			</p>
			<span class="my_right">
				<img src="@/static/icon(5).png" alt="" class="redbao1">
			</span>
			</p>
		</view>
		<view class="my_back">
			<p class="my_dingdan_gongj">
				<text class="my_dingdan1">服务与工具</text>
			</p>
			<uni-grid :column="4" :showBorder="false" :square="false" class="my_tabs">
				<uni-grid-item class="my_items1">
					<view class="pic" @click="goOrders()"><img src="@/static/xxx(7).png" class="my_topay1"></view>
					<text class="text1">会员中心</text>
				</uni-grid-item>
				<uni-grid-item class="my_items1">
					<view class="pic" @click="goOrders()"><img src="@/static/xxx(5).png" class="my_topay1"></view>
					<text class="text1">领卷中心</text>
				</uni-grid-item>
				<uni-grid-item class="my_items1">
					<view class="pic" @click="goAddress()"> <img src="@/static/xxx(4).png" class="my_topay1"></view>
					<text class="text1">地址管理</text>
				</uni-grid-item>
				<uni-grid-item class="my_items1">
					<view class="pic" @click="myfoot()"><img src="@/static/xxx(2).png" class="my_topay1"></view>
					<text class="text1">我的足迹</text>
				</uni-grid-item>
				<uni-grid-item class="my_items1">
					<view class="pic" @click="goOrders()"><img src="@/static/xxx(1).png" class="my_topay1"></view>
					<text class="text1">切换语言</text>
				</uni-grid-item>
				<uni-grid-item class="my_items1">
					<button class="text2" open-type="contact" bindcontact="handleContact" session-from="sessionFrom">
						<view class="pic"><img src="@/static/xxx(8).png" class="my_topay1"></view>
						官方客服
					</button>
				</uni-grid-item>
				<uni-grid-item class="my_items1">
					<view class="pic" @click="goOrders()"><img src="@/static/xxx(3).png" class="my_topay1"></view>
					<text class="text1">系统设置</text>
				</uni-grid-item>
			</uni-grid>
		</view>
	</view>
</template>
<script>
	import {
		request
	} from '../../../utils/request.js'
	export default {
		data() {
			return {
				likelistlength: 0,
				listList: [],
			}
		},
		methods: {
			gologin() {
				let token = uni.getStorageSync('token')
				if (token) {
					console.log("已经登录");
				} else {
					uni.navigateTo({
						url: `/pages/login/login`
					})
				}
			},
			goAddress() {
				uni.navigateTo({
					url: `/pages/component/Address/Address`,
				})
			},
			goOrders(item) {
				uni.navigateTo({
					url: `/pages/component/Orders/oriders?item=${item}`
				})
			},
			myfoot() {
				console.log(1);
				uni.navigateTo({
					url: `/pages/component/myfoot/myfoot`
				})
			},
			golike() {
				uni.navigateTo({
					url: "/pages/component/Collection/collection"
				})
			},
			//收藏列表长度
			likeListlength() {
				request({
					url: "/p/user/collection/count",
					method: "GET",
				}).then(res => {
					if (isNaN(res)) {
						this.likelistlength = 0
					} else {
						this.likelistlength = res
					}
				})
			},
			goGame() {
				uni.navigateTo({
					url: "/pages/component/Game/pages/index/index",
				})
			}
		},
		onLoad() {
			this.likeListlength()
		}
	}
</script>

<style scoped lang="scss">
	@import url("index.css");
</style>
